Imports System.Data
Imports System.Data.SqlClient

Public Class TestNieuweTekening

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        'Define connectionstring
        Dim strconnection As String
        strconnection = My.Settings.DocRegData2ConnectionString.ToString

        'Make sql-connection
        Dim objconnection As New SqlConnection(strconnection)
        objconnection.Open()

        'make insertcommandstring
        Dim strNieuweTabelTekeningenRow As String
        strNieuweTabelTekeningenRow = "INSERT Tekeningen(BedrijvenID, Bladnummer, Naam) values (@BedrijvenID, @Bladnummer, @Naam)"

        Dim insertcommand As New SqlCommand(strNieuweTabelTekeningenRow, objconnection)

        With insertcommand
            .Parameters.AddWithValue("@BedrijvenID", TxtBedrijfID.text)
            .Parameters.AddWithValue("@Bladnummer", TxtBladnummer.Text)
            .Parameters.AddWithValue("@Naam", TxtNaam.Text)
        End With

        Dim ObjDataAdapter As New SqlDataAdapter()
        ObjDataAdapter.InsertCommand = insertcommand

        'Create a new DataSet  
        Dim objDataSetNieuweTekening As New DataSet

        'Fill the DataSet using the SqlDataAdapter  
        ObjDataAdapter.Fill(objDataSetNieuweTekening, "Tekeningentabel")

        ObjDataAdapter.Update(objDataSetNieuweTekening, "Tekeningentabel")

    End Sub
End Class